﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Organizations.aspx.vb" Inherits="EagleTrackUI.OrganizationsUI" %>
<%@ Register Assembly="Infragistics4.Web.v10.3, Version=10.3.20103.1013, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.Web.UI.GridControls" tagprefix="ig" %>
<%@ Register Assembly="Infragistics4.Web.v10.3, Version=10.3.20103.1013, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.Web.UI.DataSourceControls" tagprefix="ig" %>
<%@ Register Assembly="Infragistics4.Web.v10.3, Version=10.3.20103.1013, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.Web.UI.NavigationControls" tagprefix="ig" %>
<%@ Register Assembly="Infragistics4.WebUI.UltraWebNavigator.v10.3, Version=10.3.20103.1013, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.WebUI.UltraWebNavigator" tagprefix="ignav" %>
<%@ Register Assembly="Infragistics4.WebUI.UltraWebGrid.v10.3, Version=10.3.20103.1013, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.WebUI.UltraWebGrid" tagprefix="igtbl" %>
<%@ Register Assembly="Infragistics4.Web.v10.3, Version=10.3.20103.1013, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.Web.UI.ListControls" tagprefix="ig" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
 
    <table class="style1">
        <tr>
            <td>
 
  
                                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                    <ContentTemplate >
                                    
                                    <ig:WebDataTree ID="trvOrgs" runat="server" 
                        DataSourceID="WebHierarchicalDataSource1" EnableConnectorLines="True" 
                        EnableExpandOnClick="True" Height="300px" Width="200px" SelectionType="Single">
                                        <AutoPostBackFlags SelectionChanged="On" />
                        <DataBindings>
                            <ig:DataTreeNodeBinding DataMember="SqlDataSource1_DefaultView" 
                                TextField="OrganizationName" ValueField="OrganizationID" />
                        </DataBindings>
                                      
                                    </ig:WebDataTree>
                                      <asp:Button ID="cmdAdd" runat="server" Text="Add Child Unit" />
                                             
         
        
                                    <asp:HiddenField ID="hdnOrgID" runat="server" Value="0" />
                                    </ContentTemplate>
                                    </asp:UpdatePanel>
                  
                                             
         
        
            </td>
            <td>
  
                                                           <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                                             <ContentTemplate>
                                 <table class="style1">
                    <tr>
                        <td>
                            Unit Name</td>
                        <td>
                            <asp:TextBox ID="txtUnitName" runat="server" Height="17px" Width="261px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Unit Type</td>
                        <td>
                            <asp:DropDownList ID="cboUnitType" runat="server" DataSourceID="SqlUnitTypes" 
                                DataTextField="TypeName" DataValueField="TypeID" Width="162px">
                            </asp:DropDownList>
                            <asp:SqlDataSource ID="SqlUnitTypes" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:EagleTrackUI.My.MySettings.AltDBConn %>" 
                                SelectCommand="SELECT [TypeID], [TypeName] FROM [OrgType]">
                            </asp:SqlDataSource>
                            <asp:Button ID="cmdSaveUnit" runat="server" Text="Save Unit" />
                        </td>
                    </tr>
                
                                     <tr>
                                         <td>
                                             Available Awards</td>
                                         <td>
                                             <ignav:UltraWebTree ID="chkReqs" runat="server" AutoPostBack="True" 
                                                 CheckBoxes="True" DefaultImage="" HiliteClass="" HoverClass="" Indentation="20">
                                                 <AutoPostBackFlags NodeCollapsed="False" NodeDropped="False" 
                                                     NodeExpanded="False" />
                                             </ignav:UltraWebTree>
                                         </td>
                                     </tr>
                
                                     <tr>
                                         <td>
                                             Roles</td>
                                         <td>
                                           
                   

                                             
                                             <ig:WebDataGrid ID="grdRoles" runat="server" AutoGenerateColumns="False" 
                                                 Height="350px" Width="100%" DataSourceID="edsUnitMemberships" 
                                                     DataKeyFields="UnitMemberID">
                                                 <Columns>
                                                     <ig:BoundDataField DataFieldName="UserName" DataType="System.String" 
                                                         Key="UserName">
                                                         <Header Text="User" />
                                                     </ig:BoundDataField>
                                                     <ig:BoundDataField DataFieldName="UnitRoleID" Key="UnitRoleID">
                                                         <Header Text="Role" />
                                                     </ig:BoundDataField>
                                                     <ig:BoundDataField DataFieldName="UnitMemberID" Hidden="True" 
                                                         Key="UnitMemberID">
                                                         <Header Text="BoundColumn_2" />
                                                     </ig:BoundDataField>
                                                     <ig:BoundDataField DataFieldName="OrganizationID" DataType="System.Int32" 
                                                         Key="OrganizationID" Hidden="True">
                                                         <Header Text="BoundColumn_0" />
                                                     </ig:BoundDataField>
                                                 </Columns>
                                                 <EditorProviders>
                                                     <ig:DropDownProvider ID="epUsers" StretchHeight="True">
                                                         <EditorControl ID="ddlUsers" DropDownContainerMaxHeight="200px" 
                                                             EnableAnimations="False" EnableDropDownAsChild="False" 
                                                             TextField="UserName" ValueField="UserName">
                                                             <DropDownItemBinding TextField="UserName" ValueField="UserName" />
                                                         </EditorControl>
                                                     </ig:DropDownProvider>
                                                     <ig:DropDownProvider ID="epRoles">
                                                         <EditorControl ID="cboRoles" DropDownContainerMaxHeight="200px" 
                                                             EnableAnimations="False" EnableDropDownAsChild="False" 
                                                             TextField="RoleName" ValueField="RoleID">
                                                             <DropDownItemBinding TextField="RoleName" ValueField="RoleID" />
                                                         </EditorControl>
                                                     </ig:DropDownProvider>
                                                 </EditorProviders>
                                                 <Behaviors>
                                                     <ig:EditingCore AutoCRUD="False">
                                                         <Behaviors>
                                                             <ig:CellEditing>
                                                                 <ColumnSettings>
                                                                     <ig:EditingColumnSetting ColumnKey="UserName" EditorID="epUsers" />
                                                                     <ig:EditingColumnSetting ColumnKey="UnitRoleID" EditorID="epRoles" />
                                                                 </ColumnSettings>
                                                                 <EditModeActions EnableOnActive="True" MouseClick="Single" />
                                                             </ig:CellEditing>
                                                             <ig:RowDeleting />
                                                         </Behaviors>
                                                     </ig:EditingCore>
                                                     <ig:RowSelectors>
                                                     </ig:RowSelectors>
                                                     <ig:Activation>
                                                         <AutoPostBackFlags ActiveCellChanged="True" />
                                                     </ig:Activation>
                                                     <ig:Selection>
                                                     </ig:Selection>
                                                 </Behaviors>
                                             </ig:WebDataGrid>
                                             <asp:Button ID="cmdAddNewRole" runat="server" Text="Add New" />
 
                                             <asp:EntityDataSource ID="edsUnitMemberships" runat="server" ConnectionString="name=ETModelContainer" 
                                                 DefaultContainerName="ETModelContainer" 
                                                 EnableFlattening="False" EnableUpdate="False" 
                                                 EntitySetName="UnitMemberships" Where="it.OrganizationID = @OrgID" 
                                                 AutoPage="False" AutoSort="False" 
                                                 Include="Organization,Role">
                                                 <WhereParameters>
                                                     <asp:ControlParameter ControlID="hdnOrgID" DbType="Int32" DefaultValue="0" 
                                                         Name="OrgID" PropertyName="Value" />
                                                 </WhereParameters>
                                             </asp:EntityDataSource>
                                             
     
                                           
                   
 
                                         </td>
                                     </tr>
                
                </table> 
                                                           </ContentTemplate>
                                             </asp:UpdatePanel>
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;</td>
            <td>
                <asp:Button ID="cmdDelete" runat="server" Text="Delete Unit" />
            </td>
        </tr>
    </table>
    <ig:WebHierarchicalDataSource ID="WebHierarchicalDataSource1" runat="server">
        <DataViews>
            <ig:DataView ID="SqlDataSource1_DefaultView" DataMember="DefaultView" 
                DataSourceID="SqlDataSource1" />
        </DataViews>
        <DataRelations>
            <ig:DataRelation ChildColumns="ParentID" 
                ChildDataViewID="SqlDataSource1_DefaultView" ParentColumns="OrganizationID" 
                ParentDataViewID="SqlDataSource1_DefaultView" />
        </DataRelations>
    </ig:WebHierarchicalDataSource>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:EagleTrackUI.My.MySettings.AltDBConn %>" 
        SelectCommand="SELECT * FROM [Organizations]"></asp:SqlDataSource>
 
</asp:Content>
